package StudyCode.summary.myfile;

import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;

/**
 * 版权所有 科技与人文(www.tah1986.com)
 */
public class GetFileType {
	public static void main(String[] args) throws IOException {

		Path file = Paths.get("E:\\迅雷下载", "test1.txt");
		String type;
		if (Files.isDirectory(file)) {
			type = "目录(文件夹)";
		} else {
			type = Files.probeContentType(file);
			if (type == null)
				type = "无法识别";
		}
		System.out.format("%s\t%s%n", file, type);

	}
}
